package com.example.mapper;

import com.example.entity.SysRole;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface RoleMapper {

    SysRole selectById(Long id);

    List<SysRole> selectAllRoleAndPrivileges();

    // 根据用户ID 获取用户的角色信息
    List<SysRole> selectRolesByUserId(Long userId);

    // 根据用户ID 获取用户的角色信息
    List<SysRole> selectRoleByUserIdChoose(Long userId);

    @Update({
            "update sys_role set ",
            "role_name=#{roleName}, ",
            "enabled=#{enabled}, create_by=#{createBy}, ",
            "create_time=#{createTime, jdbcType=TIMESTAMP}",
            "where id=#{id}"
    })
    int update(SysRole role);


}
